<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
 String path = request.getContextPath();
 String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<base href="<%=basePath%>">
		<title>主页 -SegmentFault</title>
		<jsp:include page="../common/_meta.jsp"></jsp:include>
	</head>
	<body>
	<jsp:include page="../common/_header.jsp"></jsp:include>
	<div class="wrap">
		<div class="inner edge">
			<div id="main">
				<div class="subhead">
					<h1 class="subtitle">浏览发现</h1>
					<nav class="hor-tabs right">
						<a <c:if test="${tab eq 'index' || tab == null }">class="current"</c:if> href="index">最新的</a><i></i> 
						<a <c:if test="${tab eq 'hot' }">class="current"</c:if> href="hottest">热门的</a><i></i>
						<a <c:if test="${tab eq 'cold' }">class="current"</c:if> href="unanswered">未回答的</a><i></i> 
						<a href="ask" class="btn-regular">我要提问</a>
					</nav>
				</div>
				<!-- end .subhead -->
				<div id="content">
					<c:forEach var="quest" items="${questionList }">
						<article class="post" id="${quest.id }">
							<div class="status">
								<c:choose>
									<c:when test="${tab eq 'cold' }">
										<span class="answer" title="0个回答">0</span> 
									</c:when>
									<c:otherwise>
										<span class="answer answered-accepted" title="最新">1</span>
									</c:otherwise>
								</c:choose>
								<span class="vote" title='${quest.jack_num } 个投票' >${quest.jack_num }</span>
							</div>
							<div class="p-summary">
								<a class="author tip-pop" href="u/${quest.user_id }" >
			                    	<img class="avatar-32" src="${quest.head_photo }" alt="${quest.login_name }">
			                   	</a>
			                   	<h2><a href="q/${quest.id }" title="${quest.title }" >${quest.title }</a></h2>
			                   	<div class="meta">
			                   		<span class="datetime">${quest.asktime }</span>
			                   	</div>
						</article>
					</c:forEach>
					<jsp:include page="../common/_page.jsp"></jsp:include>
				</div>
				<!-- end #content -->
			</div>
			<!-- end #main -->

			<div id="secondary">
				<c:choose>
					<c:when test="${user == null}">
						<aside class="greeting">
							<h3>这是什么网站？</h3>
							<p>这是一个专业面向开发者的问答社区，您可以在这里提出任何与开发相关的问题，并得到同行的解答和评价。无需注册即可登录。</p>
							<p class="hor-tabs">
								<a href="user/login">立即登录</a> <i></i> 
								<a href="about">了解更多</a>
							</p>
						</aside>
						<aside class="box">
							<a href="user/timeline" class="tip-pop i-more right" data-tip="s:更多" original-title="">更多</a>
							<h3>新鲜事</h3>
							<ul class="timestream show-pop-tag">
								<li class="nothing">暂时没有新鲜事哦<br>关注了别人就会有新鲜事
								</li>
							</ul>
						</aside>
					</c:when>
					<c:otherwise>
						<aside id="my-account">
							<div class="my-avatar avatar-64" style="background: url(${user.head_photo}) no-repeat center center">
								<a href="user/settings">修改头像</a>
							</div>
							<h3>
								<a href='u/${user.id}'>${user.login_name}</a>
							</h3>
							<p>
								<a href='u/${user.id}/questions'>0提问</a> ? 
								<a href='u/${user.id}/answers'>0回答</a><br>
								<span class="level-1" title="排名: 80% 以后">活跃度${user.liveness}</span><br>
							</p>
						</aside>
						<aside>
							<ul class="list-menu">
								<li class="current"><a href="index">所有提问</a></li>
								<li><a href="user/invited">我的回答</a></li>
								<li><a href="user/rank">声望和权限</a></li>
							</ul>
						</aside>
						<aside class="box">
							<a href="user/timeline" class="tip-pop i-more right" data-tip="s:更多" original-title="">更多</a>
							<h3>新鲜事</h3>
							<ul class="timestream show-pop-tag">
								<li class="nothing">暂时没有新鲜事哦<br>关注了别人就会有新鲜事
								</li>
							</ul>
						</aside>
					</c:otherwise>
				</c:choose>
			</div>
			<!-- end #secondary -->
		</div>
	</div><!-- end wrap -->
	<jsp:include page="../common/_footer.jsp"></jsp:include>
	</body>
</html>

